import { request } from '@boeyo/portal';

//轻量化结构台阵观测评估报告列表
export const getLightweightHealthList = (params) => {
  return request({
    url: '/healthEstimate/observeReportList',
    method: 'GET',
    params,
  });
};

// 获取事件数据
export function getEventData(projectId) {
  return request({
    url: '/projectQuickReport/quickReportList?projectId=' + projectId,
    method: 'get',
  });
}

/**
 * 轻量化结构台阵观测：生成报告
 */
export const getGenerateReport = (data) => {
  return request({
    url: '/healthEstimate/observeReport',
    method: 'POST',
    data,
  });
};

/**
 *
 * @param docType docType：pdf，docx
 * @param params 其他参数
 * @param closeDownload 预览还是直接下载
 * @returns
 */
export const getPreviewReport = (
  docType: any,
  params: any,
  closeDownload?: boolean,
) => {
  return request({
    url: `/healthEstimate/healthReport/${docType}`,
    method: 'get',
    responseType: 'blob',
    params,
    closeDownload,
  });
};
/**
 * 预览轻量化结构台阵观测评估报告获取所有图片
 */
export const getEarthquakeReportPng = (reportId) => {
  return request({
    url: `/healthEstimate/export/png/${reportId}`,
    method: 'GET',
  });
};

/**
 * 监测列表树形列表
 */
export const fetchStructureTree = (data = {}) => {
  return request({
    url: '/monitoring/tree',
    method: 'POST',
    data,
  });
};

/**
 * 轻量化结构台阵观测评估报告下载
 */
export const getEarthquakeReport = (params: any, closeDownload?: boolean) => {
  return request({
    url: '/healthEstimate/export',
    method: 'GET',
    responseType: 'blob',
    params,
    closeDownload,
  });
};
/**
 * 轻量化结构台阵观测评估预览
 */
export const previewReport = (data) => {
  return request({
    url: '/healthEstimate/view',
    method: 'POST',
    data,
  });
};
